import   axios   from "../utils/axios.js";
axios.defaults.headers.put['Content-Type'] = 'application/json';

// 获取员工数据
export function getEmployeePageInfo(opt){
    return axios({
        method: 'get',
        baseURL: '/api',
        url: '/employee/getPageInfo',
        params:{
            'name': opt.name,
            'page': opt.page,
            'pageSize': opt.pageSize
        }
    })
}

// 修改员工数据
export function setEmployee(data){
    return axios({
        method: 'put',
        baseURL: '/api',
        url: 'employee',
        data:  JSON.stringify(data),
        header:{
            'Content-Type':'application/json'  //如果写成contentType会报错,如果不写这条也报错
            //Content type 'application/x-www-form-urlencoded;charset=UTF-8'...
        }
    })
}

// 添加员工数据
export function updataEmployee(data){
    return axios({
        method: 'post',
        baseURL: '/api',
        url: 'employee',
        data:  data,
        header:{
            'Content-Type':'application/json'  //如果写成contentType会报错,如果不写这条也报错
            //Content type 'application/x-www-form-urlencoded;charset=UTF-8'...
        }
    })
};

// 获取个人员工数据
export function getPersonalInfo(opt){
    return axios({
        method: 'get',
        baseURL: '/api',
        url: '/employee/getPageInfo',
        params:{
            id: opt.id,
            page: 1,
            pageSize: 10
        }
    })
}

